package org.testis.serialportmodule.services;

import org.testis.data.TestStepDataObject;
import org.testis.serialportmodule.core.SerialConnectionInterface;
import org.testis.serialportmodule.data.SerialPortModuleDataObject;
import org.testis.services.AtofModuleService;


public class SerialPortModuleProviderService extends AtofModuleService
{

    SerialConnectionInterface m_serialConnection;


    public SerialPortModuleProviderService()
    {
    }


    @Override
    public void setDataObj(TestStepDataObject m_dataObj)
    {
        super.setDataObj(m_dataObj);
        m_serialConnection = SerialConnectionProvider.getInstance().
            getSerialConnectionProvider(
            (SerialPortModuleDataObject) getDataObj());

    }
    public void endSerialconnection() throws Exception
    {
        if(m_serialConnection!=null){
          SerialConnectionProvider.getInstance().removeSerialConnectionProvider(getDataObj().getMessageId());
          m_serialConnection.endConnection();
          m_serialConnection=null;
          
        }

    }
}
